import React from "react";
import { MyContext } from "../D2UseContext";
import Grand from "./grandComponents"
const ChildComponent = () => {
  return (
    <MyContext.Consumer>
      {({ year, setYear }) => (
        <div>
          <h2>GrandComponent</h2>
          <p>Current Year: {year}</p>
        
          <button onClick={() => setYear(year + 1)}>Increase Year</button>
          <Grand></Grand>
        </div>
      )}
    </MyContext.Consumer>
  );
};

export default ChildComponent;